package web.mb;

import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import metier.entities.Industrie;
import metier.sess.IIndustrieLocal;



@ManagedBean
@RequestScoped
public class IndustrieMB {
	@EJB
	private IIndustrieLocal metier;
	
	private Integer Id;
	private String Intitule;
	private boolean Statut;
	private Industrie in;
	
	
	
	public String Ajouter()
	{
		
		
		Industrie i=new Industrie(Intitule, Statut);
		metier.addIndustrie(i);
		return "ManageIndustry.xhtml";
	}
	
	
	
	
	public String edit(Integer Id)
	{
		this.Id=Id;
		Industrie c=metier.getIndustrie(Id);
		this.Intitule=c.getIntitule();
		this.Statut=c.getStatut();
		
		return "EditIndustry.xhtml";
		
	}
	
	public String Modifier()
	{
		Industrie c=metier.getIndustrie(Id);
		c.setIntitule(Intitule);
		c.setStatut(Statut);
		metier.updateIndustrie(c);
		return "ManageIndustry.xhtml";
	}

	public String Supprimer(Integer Id)
	{
		
		metier.deleteIndustrie(Id);
		return "succes";
		
	}
	
	
	
	public List<Industrie> getListIndustrie()
	{
		return metier.getAllIndustrie();
	}

	
	public Integer getId() {
		return Id;
	}

	public void setId(Integer id) {
		Id = id;
	}

	public String getIntitule() {
		return Intitule;
	}

	public void setIntitule(String intitule) {
		Intitule = intitule;
	}

	public boolean isStatut() {
		return Statut;
	}

	public void setStatut(boolean statut) {
		Statut = statut;
	}
	
	public Industrie getIn() {
		
		return in;
	}

	public void setIn(Industrie In) {
		
		this.in = In;
	}

}
